import {reviewStatusObj} from '@/assets/js'
export default function dataFn(data,tableHeade){
    let tabStr = ''
    data.forEach((item, index) => {
        let tabRowStr = "";
        tabStr += `<tr>`;
        for (let i = 0; i < tableHeade.length; i++ ) {
            const key = tableHeade[i]
            if (key === 'departments_id') {
                tabRowStr += `<td>${item.department?item.department.name:''}</td>`;
            }else if(key === 'review_status'){
                tabRowStr += `<td>${reviewStatusObj[item.review_status]}${item.review_status === 2 ? ('：' + item.review_comment) : ''}</td>`;
            }else {
              tabRowStr += `<td>${item[key] || ''}</td>`;
            }
        }
        tabStr += tabRowStr;
        tabStr += "</tr>";
    });
    return tabStr
}

